package org.execute.tool.键鼠工具;

import java.util.HashMap;
import java.util.Map;

     // ====================== 2. 命令实体类（不变）======================
public  class InputCommand {
    private final CommandType commandType;
    private final Map<String, Object> params;

    public InputCommand(CommandType commandType, Map<String, Object> params) {
        this.commandType = commandType;
        this.params = params != null ? new HashMap<>(params) : new HashMap<>();
        validateParams();
    }

    private void validateParams() {
        for (String requiredParam : commandType.getRequiredParams()) {
            if (!params.containsKey(requiredParam) || params.get(requiredParam) == null) {
                throw new IllegalArgumentException(
                        "命令【" + commandType.getDesc() + "】缺少必填参数：" + requiredParam
                );
            }
        }
    }

    public CommandType getCommandType() {
        return commandType;
    }

    public Map<String, Object> getParams() {
        return params;
    }
}
